// 笔试强训：游游的水果大礼包

#include <iostream>
using namespace std;
 
int main()
{
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    //x:a元礼包的个数,y:b元礼包的个数,总价值:x*a+y*b
    long x, y;
    long price = 0;
    for(int i = 0; i <= n; ++i)
    {
        x = min(i / 2, m);
        y = min(n - 2 * x, (m - x) / 2);
        price = max(price, x * a + y * b);
    }
    cout << price << endl;
    return 0;
}